package com.mycompany.server;

import com.mycompany.protocol.RootJobCommand;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author artyukhov
 */
public class RootJob implements Container {

    private final List<Job> jobList = new ArrayList<Job>();
    private final List<Session> sessionList = new ArrayList<Session>();

    @Override
    public synchronized void addSession(Session session) {
        this.sessionList.add(session);
        session.setContainer(this);
        notifyAllSessions();
    }

    @Override
    public synchronized void removeSession(Session session) {
        this.sessionList.remove(session);
        notifyAllSessions();
    }

    public synchronized void addJob(Job job) {
        this.jobList.add(job);
        notifyAllSessions();
    }

    private void notifyAllSessions() {
        for (Session session : sessionList) {
        }
    }

    private RootJobCommand createRootJobCommand() {

        return null;
    }
}
